package arrary;

public class Arr7 {
    public static void main(String[] args) {
        //交换数据，定义一个数组，存入1,2,3,4,5交换首位对应元素
        //交换前为：12345，交换后为：54321
        int [] arr = {1,2,3,4,5};
        for (int i = 0,j = arr.length - 1; i <j ; i++,j--) {
            int temp = arr[i];
            arr[i] = arr[j];
            arr[j] = temp;
        }
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i]+" ");
        }
    }
}
